<template>
  <div id="app">
   <map-container @load="load" :style-url="style" auth-type="Authorization"></map-container>
  </div>
</template>

<script>
  import EditArea from "./tool/edit/EditArea";
  import Graffiti from "./tool/edit/Graffiti";
  // import ClickEdit from "./tool/edit/ClickEdit";
  // import Mini from "./tool/edit/ClickEdit";
  import MapContainer from "./components/map/MapContainer";
  // import MiniMap from "./components/control/MiniMap";
  import MapCommon from "./common/MapCommon";
  import Touch from "./tool/longTouch/LongTouch";
  import DrawAreaControl from "./tool/control/DrawAreaControl";
  import  "./assets/index.less"
  import  "./assets/iconfont.css";

  export default {
  name: 'app',
  components:{MapContainer},
  data () {
    return {
      style: 'http://120.133.60.156:9035/api/v1/styles/gykj/rJxP2DamuX',
      replaceUrl: [{
        origin:"gykj123.cn",
        target:"120.133.60.156"
      }]
    }
  },
  created(){
    localStorage.setItem("token","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiIsImNvbnRleHRVc2VySWQiOiIwIiwiY29udGV4dE5hbWUiOiLotoXnuqfnrqHnkIblkZgiLCJjb250ZXh0RGVwdElkIjoiMCIsImNvbnRleHRBcHBsaWNhdGlvbklkIjoiMCIsImlhdCI6MTYxNTU0ODQyNiwiZXhwIjoxNjMxMTAwNDI2fQ.NE2hxhrxtyhNWtvtuZVh1TCJ0idPAp5uYwTRmIPRyYE")
  },
  mounted(){

},
  methods:{
    load(map){
      // console.log("已加载");
      // console.log()
      // map.addControl(new MiniMap({showPointLayers:[],}), 'top-right');
      // MapCommon.copyLineToAreaFit(map,"省域","test")
      // let longTouch=new Touch(map,"test",res=>{
      //   console.log(res);
      // })

      // let tool= new Graffiti(map,{callBack:(res)=>{
     //    console.log(res)
     //    }})
     //
     //  tool.start()

      // let tool= new ClickEdit(map,{clickLayers:["种植地块","承保地块","村域"],callBack:(feature)=>{
      //   console.log(feature)
      //   },features:[],
      //   clickLayersFilters:[]});
      // let tool =new DrawArea(map,{callBack:(res)=>{
      //   console.log(res);
      // },errorCallBack:err=>{
      //   console.error(err);
      // }})
      // tool.start()
      // setTimeout(()=>{
      //   console.log("关闭")
      //   // tool.closeByHand();
      // },10000)
      let control=new DrawAreaControl((feature)=>{
         console.log("feature",feature)
      },e=>{
        console.log("取消")
      });
      map.addControl(control, 'bottom-right')
    }
  }
}
</script>

<style lang="css">
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  width: 100%;
  height: 100vh;
}
body,html{
  padding: 0;
  margin: 0;
}

</style>
